******************************************************
***ONLINE ABUSE OF POLITICIANS - SUMMER 2022**********
******************************************************
***Written for Stata 17*******************************
******************************************************

	clear all
	use Online_abuse_replication_file.dta
	
	
**********************************
***Installing required packages***
**********************************
*Note, to execute correctly, this do-file requires the packages "estout", "coefplot" and "blindschemes" 
	* ssc install estout //Run this line if estout is not already installed (used when creating regression tables)
	* ssc install coefplot //Run this line if "Coefplot" is not already installed (used when plotting results in graphs)
	* ssc install blindschemes //Run this line if "blindschemes is not already installed (used to control graph layout) 
		
	
*******************************
***Setting graph preferences***
*******************************	
	set scheme plotplain
	graph set window fontface "Perpetua"
		
	* the "mlabel" macro defined below is used - in a really clunky way! - to ensure trailing zeroes in the marker label values
	#delimit ;
	global 	mlabel `"mlabel(cond(@b>.095&@b<.105,".10", 
							cond(@b>.195&@b<.205,".20",	
							cond(@b>.295&@b<.305,".30", 
							cond(@b>.395&@b<.405,".40",
							cond(@b>.495&@b<.505,".50",
							cond(@b>.595&@b<.605,".60",
							cond(@b>.695&@b<.705,".70",
							cond(@b>.795&@b<.805,".80",
							cond(@b>.895&@b<.905,".90",
							cond(@b>.995,"1.00", 
							string(@b, "%9.2g")))))))))))) 
							mlabposition(2) mlabsize(medium)"' ;
	#delimit cr	
		
		
		
**************
***ANALYSES***
**************

*Descriptive results, individual items
	reg abusive i.message, cluster(mergenum) 
	margins i.message 
	*coefplot, title("Abusive")

	reg legit i.message, cluster(mergenum) 
	margins i.message 
	*coefplot, title("Legit")

	reg report i.message, cluster(mergenum) 
	margins i.message 
	*coefplot, title("Report")
	
*Descriptive results, index
	reg aversion i.message, cluster(mergenum) 
	margins i.message, post 
	coefplot, 	headings(1.message = "{bf: Criticism}" 6.message = "{bf: Insults}" 11.message = "{bf: Threats}" 16.message = "{bf: Sexism}" ,  labsize(medlarge)) ///
				grid(within glpattern(solid) glwidth(*0.25)) title("") ylabel(,labsize(medium)) xlabel(0(.1)1, labsize(medium) nogrid) msize(medium) msymbol(circle) mlcolor(black) xsize(6) ysize(3) legend(off) ciopts(color(black)) ///
				 $mlabel mlabposition(3) mlabgap(*3) mlabsize(medium) 	graphregion(margin(l=-8))			
				graph export aversion_all_comments.tif, replace
	tabstat aversion, statistics( mean sd min max ) by(message)

*Descriptive results, comment types, individual items
	reg abusive i.messagetype, cluster(mergenum) 
	margins i.messagetype 
	*coefplot, title("Abusive")

	reg legit i.messagetype, cluster(mergenum) 
	margins i.messagetype 
	*coefplot, title("Legit") 

	reg report i.messagetype, cluster(mergenum) 
	margins i.messagetype 
	*coefplot, title("Report") 

*Descriptive results, comment types, index
	reg aversion i.messagetype, cluster(mergenum) 
	margins i.messagetype, post 
	*coefplot, 	title("") nolabel 	coeflabels(1.messagetype = "{it: Criticism}" 2.messagetype= "{it: Insults}" 3.messagetype = "{it: Threats/Incitement}" 4.messagetype = "{it: Sexism}") ///
	*			ylabel(,labsize(small))  xlabel(0(.1)1, labsize(medsmall)) msize(medium) msymbol(circle) mlcolor(black) xsize(6) ysize(3) legend(off) ciopts(color(black)) $mlabel mlabgap(*.5) mlabsize(vsmall) 
	*graph export aversion_commentypes.emf, replace

	tabstat aversion, statistics( mean sd min max ) by(messagetype)
			
	*histogram aversion, bin(10) percent  addlabel  addlabopts(yvarformat(%4.0f)) by(messagetype, rows(1)) title("") xtitle("Aversion")   by(, note("")) subtitle(, box)
	histogram aversion, bin(10) percent  by(messagetype, rows(1)) title("") xtitle("Aversion")   by(, note("")) subtitle(, size(large)) ylabel(0(10)80, labsize(medium) glwidth(*0.2) glpattern(solid)) xlabel(0(.2)1, labsize(medium) nogrid)
	graph export aversion_histogram.tif, replace	
	
	*histogram abusive, discrete percent by(messagetype, rows(1)) title("") xtitle("Comment is abusive") by(, note("")) subtitle(, nobox)
	
	graph bar, 	over(abusive, relabel(1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" ) ) ///
				by(, title("                              " "The comment" "is abusive", position(9) ) note("")) by(, legend(off))  by(messagetype, rows(1))  blabel(bar, format(%9.0f"%")) ytitle("") yscale(r(0 85)) ///
				subtitle(, size(large)) ylabel(0(10)80, labsize(medium) glwidth(*0.25) glpattern(solid))
				graph save abusive_bar, replace
	graph bar, 	over(legit, relabel(1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" ) ) ///
				by(, title("Politicians should" "be able to tolerate" "comments like this", position(9) ) note("")) by(, legend(off)) by(messagetype, rows(1))  blabel(bar, format(%9.0f"%")) ///
				subtitle(, size(zero) color(none) nobox fcolor()) ytitle("") ylabel(0(10)80, labsize(medium) glwidth(*0.25) glpattern(solid))
				graph save legit_bar, replace
	graph bar, 	over(report, relabel(1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" ) ) ///
				by(, title("I would report" "this message to" "Twitter/Facebook", position(9)) note(""))  by(messagetype, rows(1))  blabel(bar, format(%9.0f"%")) ///
				subtitle(, size(zero) color(none) nobox fcolor()) ytitle("") yscale(r(0 80)) ylabel(0(10)80, labsize(medium) glwidth(*0.25) glpattern(solid)) 
				graph save report_bar, replace
	graph combine abusive_bar.gph legit_bar.gph report_bar.gph, row(3) ycommon xsize(6) ysize(4) imargin(zero)
	graph export items_aversion.tif, replace
	erase abusive_bar.gph 
	erase legit_bar.gph 
	erase report_bar.gph
	
  

*HYPOTHESIS 1: "Politicians are more averse to negative messages directed at a politician from their own party than negative messages directed at a politician from another party"

	*Primary model
	reg aversion i.messagetype##i.ownparty, cluster(mergenum) 
	eststo aversion_ownparty
	margin, dydx(ownparty)								// These results determine H1!
	margin, dydx(ownparty) at(messagetype=(1 2 3 4))  	// These results determine H1!
		
	*FIGURE: Aversion to negative messages, conditional on partisanship
	estimates restore aversion_ownparty
	margins i.messagetype#ownparty, post
	eststo aversion_ownparty_fig
	coefplot 	(aversion_ownparty_fig, mfcolor(gs6) keep(*#0.ownparty)) (aversion_ownparty_fig, mfcolor(white) keep(*#1.ownparty)), ///
				headings(1.messagetype#0.ownparty = "{bf: Criticism}" 2.messagetype#0.ownparty = "{bf: Insults}" 3.messagetype#0.ownparty = "{bf: Threats}" 4.messagetype#0.ownparty = "{bf: Sexism}",  labsize(medlarge) ) ///
				coeflabels(1.messagetype#0.ownparty  2.messagetype#0.ownparty  3.messagetype#0.ownparty  4.messagetype#0.ownparty  = "Another party" ///
				1.messagetype#1.ownparty  2.messagetype#1.ownparty  3.messagetype#1.ownparty  4.messagetype#1.ownparty  = "Own party") ///
				order(1.messagetype#0.ownparty 1.messagetype#1.ownparty  2.messagetype#0.ownparty 2.messagetype#1.ownparty   3.messagetype#0.ownparty  3.messagetype#1.ownparty  4.messagetype#0.ownparty  4.messagetype#1.ownparty  ) ///
				grid(within glpattern(solid) glwidth(*0.25))  title("") ylabel(,labsize(medium))  xlabel(0(.1)1, labsize(medium) nogrid) msize(large) msymbol(circle) mlcolor(black) xsize(6) ysize(3) legend(off) ciopts(color(black)) $mlabel 
				graph export aversion_ownparty.tif, replace

	*FIGURE FOR APPENDIX: RESULTS FOR INDIVIDUAL ITEMS
	reg abusive i.messagetype##i.ownparty, cluster(mergenum) 
	margin, dydx(ownparty)								
	margin, dydx(ownparty) at(messagetype=(1 2 3 4))  	
	margins i.messagetype#ownparty, post
	eststo abusive_ownparty_fig
	
	reg legit i.messagetype##i.ownparty, cluster(mergenum) 
	margin, dydx(ownparty)								
	margin, dydx(ownparty) at(messagetype=(1 2 3 4))  	
	margins i.messagetype#ownparty, post
	eststo legit_ownparty_fig
	
	reg report i.messagetype##i.ownparty, cluster(mergenum) 
	margin, dydx(ownparty)								
	margin, dydx(ownparty) at(messagetype=(1 2 3 4)) 
	margins i.messagetype#ownparty, post
	eststo report_ownparty_fig
	
	coefplot 	(abusive_ownparty_fig, mfcolor(gs6) keep(*#0.ownparty))	(abusive_ownparty_fig, mfcolor(white) keep(*#1.ownparty)), 	bylabel("The comment" "is abusive") subtitle(, size(large)) || 	///
				(legit_ownparty_fig, mfcolor(gs6) keep(*#0.ownparty)) 	(legit_ownparty_fig, mfcolor(white) keep(*#1.ownparty)),	bylabel("Politicians should be able" "to tolerate comments like this") || ///
				(report_ownparty_fig, mfcolor(gs6) keep(*#0.ownparty))	(report_ownparty_fig, mfcolor(white) keep(*#1.ownparty)), 	bylabel("I would report this message" "to [Twitter/Facebook]")   ///
				byopts(row(1) legend(off) ) ///
				headings(1.messagetype#0.ownparty = "{bf: Criticism}" 2.messagetype#0.ownparty = "{bf: Insults}" 3.messagetype#0.ownparty = "{bf: Threats}" 4.messagetype#0.ownparty = "{bf: Sexism}",  labsize(medlarge) ) ///
				coeflabels(1.messagetype#0.ownparty  2.messagetype#0.ownparty  3.messagetype#0.ownparty  4.messagetype#0.ownparty  = "Another party" ///
				1.messagetype#1.ownparty  2.messagetype#1.ownparty  3.messagetype#1.ownparty  4.messagetype#1.ownparty  = "Own party") ///
				order(1.messagetype#0.ownparty 1.messagetype#1.ownparty  2.messagetype#0.ownparty 2.messagetype#1.ownparty   3.messagetype#0.ownparty  3.messagetype#1.ownparty  4.messagetype#0.ownparty  4.messagetype#1.ownparty  ) ///
				grid(within glpattern(solid) glwidth(*0.25)) title("") ylabel(,labsize(medium))  xlabel(0(.1)1, labsize(medium) nogrid) msize(large) msymbol(circle) mlcolor(black) xsize(6) ysize(3) ciopts(color(black)) $mlabel 
				graph export items_ownparty.tif, replace
				
				
				
	
*HYPOTHESIS 2: "Aversion to sexist messages is stronger among politicians on the political left than politicians on the political right" 
*HYPOTHESIS 2b: "Aversion to negative messages differs between politicians on the left and politicians on the right"

	*Primary model
	reg aversion i.messagetype##c.lr, cluster(mergenum)
	eststo aversion_lr
	margin, dydx(lr) 							// These results determine H2 and H2b
	margin, dydx(lr) at(messagetype=(1 2 3 4)) 	// These results determine H2 and H2b
	margins, at(messagetype=(4) lr=(0 1 2 3 4 5 6 7 8 9 10))
	
		
	*FIGURE: Aversion to negative messages, conditional on LR
	estimates restore aversion_lr
	margins, at(messagetype=(1 2 3 4) lr=(0 2 4 6 8 10)) post
	eststo aversion_lr_fig
	coefplot 	(aversion_lr_fig, ciopts(lwidth(thin) lcolor(black))) ///
				(aversion_lr_fig, $mlabel mlabposition(12) mlabgap(*.7) keep(1._at 7._at 13._at 19._at ) noci) ///
				(aversion_lr_fig, $mlabel mlabposition(6) mlabgap(*.01) keep(6._at 12._at  18._at 24._at) noci), ///
				headings(1._at = `" "{bf: Criticism}" " " "' 7._at = `" "{bf: Insults}" " " "' 13._at = `" "{bf: Threats}" " " "' 19._at = `" "{bf: Sexism}" " " "', gap(5) labsize(medlarge) ) 	///
				coeflabels(	1._at  7._at 13._at 19._at = "0: left" ///
							2._at  8._at 14._at 20._at = " " ///
							3._at  9._at 15._at 21._at = " " ///
							4._at  10._at 16._at 22._at = " " ///
							5._at  11._at 17._at 23._at = " " ///
							6._at  12._at 18._at 24._at = "10: right" ) ///
							grid(within glpattern(solid) glwidth(*0.25)) title("") ylabel(,labsize(medium)) xlabel(0(.1)1, labsize(medium) nogrid) msymbol(circle) mlcolor(black) mfcolor(white) mlwidth(thin) ciopts(color(black)) ///
							xsize(6) ysize(3) legend(off) nooffset plotregion(margin(medium)) 
				graph export aversion_lr.tif, replace			
					
				
	*FIGURE FOR APPENDIX: RESULTS FOR INDIVIDUAL ITEMS
	reg abusive i.messagetype##c.lr, cluster(mergenum)
	margin, dydx(lr) 							
	margin, dydx(lr) at(messagetype=(1 2 3 4)) 	
	margins, at(messagetype=(1 2 3 4) lr=(0 2 4 6 8 10)) post
	eststo abusive_lr_fig
	
	reg legit i.messagetype##c.lr, cluster(mergenum)
	margin, dydx(lr) 							
	margin, dydx(lr) at(messagetype=(1 2 3 4)) 	
	margins, at(messagetype=(1 2 3 4) lr=(0 2 4 6 8 10)) post
	eststo legit_lr_fig

	reg report i.messagetype##c.lr, cluster(mergenum)
	margin, dydx(lr) 							
	margin, dydx(lr) at(messagetype=(1 2 3 4)) 	
	margins, at(messagetype=(1 2 3 4) lr=(0 2 4 6 8 10)) post
	eststo report_lr_fig
	
	coefplot 	(abusive_lr_fig, ciopts(lwidth(thin) lcolor(black))) ///
				(abusive_lr_fig, $mlabel mlabposition(12) mlabgap(*.7) keep(1._at 7._at 13._at 19._at ) noci) ///
				(abusive_lr_fig, $mlabel mlabposition(6) mlabgap(*.01) keep(6._at 12._at  18._at 24._at) noci) , 	bylabel("The commment" "is abusive") subtitle(, size(large))  || ///
				(legit_lr_fig, ciopts(lwidth(thin) lcolor(black))) 	///
				(legit_lr_fig, $mlabel mlabposition(12) mlabgap(*.7) keep(1._at 7._at 13._at 19._at ) noci) ///
				(legit_lr_fig, $mlabel mlabposition(6) mlabgap(*.01) keep(6._at 12._at  18._at 24._at) noci), bylabel("Politicians should be able" "to tolerate comments like this") || ///
				(report_lr_fig, ciopts(lwidth(thin) lcolor(black))) 	///
				(report_lr_fig, $mlabel mlabposition(12) mlabgap(*.7) keep(1._at 7._at 13._at 19._at ) noci) ///
				(report_lr_fig, $mlabel mlabposition(6) mlabgap(*.01) keep(6._at 12._at  18._at 24._at) noci), bylabel("I would report this message" "to [Twitter/Facebook]" ) ///
				byopts(row(1) legend(off)) ///
				nolabel headings(1._at = `" "{bf: Criticism}" " " "' 7._at = `" "{bf: Insults}" " " "' 13._at = `" "{bf: Threats}" " " "' 19._at = `" "{bf: Sexism}" " " "', gap(5) labsize(medlarge) ) 	///
				coeflabels(	1._at  7._at 13._at 19._at = "0: left" ///
							2._at  8._at 14._at 20._at = " " ///
							3._at  9._at 15._at 21._at = " " ///
							4._at  10._at 16._at 22._at = " " ///
							5._at  11._at 17._at 23._at = " " ///
							6._at  12._at 18._at 24._at = "10: right" ) ///
							grid(within glpattern(solid) glwidth(*0.25)) title("") ylabel(,labsize(medium)) xlabel(0(.1)1, labsize(medium) nogrid) msymbol(circle) mlcolor(black) mfcolor(white) mlwidth(thin) ciopts(color(black)) ///
							xsize(6) ysize(3) legend(off) nooffset plotregion(margin(medium)) 
				graph export items_lr.tif, replace			
	
	
	
*HYPOTHESIS 3: "Politicians are more averse to negative comments directed at women than negative comments directed at men"

	*Primary model
	reg aversion i.messagetype##i.gender_post, cluster(mergenum) 
	eststo aversion_genderpost
	margins, dydx(gender_post)								// these results determine H3
	margins, dydx(gender_post) at(messagetype=(1 2 3 4)) 	// these results determine H3
	
	
	*FIGURE: Aversion to negative messages, conditional on gender of victim
	estimates restore aversion_genderpost
	margins i.messagetype#gender_post, post
	eststo aversion_genderpost_fig
	coefplot 	(aversion_genderpost_fig, mfcolor(gs6) keep(*#2.gender_post) ) (aversion_genderpost_fig, mfcolor(white) keep(*#3.gender_post)), 	///
				headings(1.messagetype#2.gender_post = "{bf: Criticism}" 2.messagetype#2.gender_post = "{bf: Insults}" 3.messagetype#2.gender_post = "{bf: Threats}" 4.messagetype#2.gender_post = "{bf: Sexism}", labsize(medlarge)) 	/// 
				coeflabels(1.messagetype#2.gender_post 2.messagetype#2.gender_post 3.messagetype#2.gender_post 4.messagetype#2.gender_post = "Male victim" ///
				1.messagetype#3.gender_post 2.messagetype#3.gender_post 3.messagetype#3.gender_post 4.messagetype#3.gender_post = "Female victim") ///
				order(1.messagetype#2.gender_post 1.messagetype#3.gender_post 2.messagetype#2.gender_post 2.messagetype#3.gender_post 3.messagetype#2.gender_post ///
				3.messagetype#3.gender_post  4.messagetype#2.gender_post 4.messagetype#3.gender_post ) ///
				grid(within glpattern(solid) glwidth(*0.25)) title("") ylabel(,labsize(medium))  xlabel(0(.1)1, labsize(medium) nogrid) msize(large) msymbol(circle) mlcolor(black) xsize(6) ysize(3) legend(off) ciopts(color(black)) $mlabel 
				*text(6.5 0.65 "]*") // this line is work in progress!
				*text(6.5 0.65 "┐" " *" "┘" "]*") // this line is work in progress!
				*addplot:  scatteri 6.5 0.65 "┐""*", msymbol(none)  norescaling // this line is work in progress!
				graph export aversion_victim_gender.tif, replace
			
	
	*FIGURE FOR APPENDIX: RESULTS FOR INDIVIDUAL ITEMS
	reg abusive i.messagetype##i.gender_post, cluster(mergenum) 
	margins i.messagetype#gender_post, post
	eststo abusive_genderpost

	reg legit i.messagetype##i.gender_post, cluster(mergenum) 
	margins i.messagetype#gender_post, post
	eststo legit_genderpost

	reg report i.messagetype##i.gender_post, cluster(mergenum) 
	margins i.messagetype#gender_post, post
	eststo report_genderpost
				
	coefplot 	(abusive_genderpost, mfcolor(gs6) keep(*#2.gender_post)) (abusive_genderpost, mfcolor(white) keep(*#3.gender_post)), bylabel("The commment" "is abusive") subtitle(, size(large)) || 	///
				(legit_genderpost, mfcolor(gs6) keep(*#2.gender_post)) (legit_genderpost, mfcolor(white) keep(*#3.gender_post)), bylabel("Politicians should be able" "to tolerate comments like this") || 	///
				(report_genderpost, mfcolor(gs6) keep(*#2.gender_post)) (report_genderpost, mfcolor(white) keep(*#3.gender_post)), bylabel("I would report this message" "to [Twitter/Facebook]")  	///
				byopts( row(1) legend(off))  ///
				headings(1.messagetype#2.gender_post="{bf: Criticism}" 2.messagetype#2.gender_post="{bf: Insults}" 3.messagetype#2.gender_post="{bf: Threats}" 4.messagetype#2.gender_post="{bf: Sexism}", labsize(medlarge)) 	/// 
				coeflabels(1.messagetype#2.gender_post 2.messagetype#2.gender_post 3.messagetype#2.gender_post 4.messagetype#2.gender_post = "Male victim" 	///
				1.messagetype#3.gender_post 2.messagetype#3.gender_post 3.messagetype#3.gender_post 4.messagetype#3.gender_post = "Female victim") 			///		
				order(1.messagetype#2.gender_post 1.messagetype#3.gender_post 2.messagetype#2.gender_post 2.messagetype#3.gender_post 3.messagetype#2.gender_post 3.messagetype#3.gender_post ///
				4.messagetype#2.gender_post 4.messagetype#3.gender_post)	///
				grid(within glpattern(solid) glwidth(*0.25)) title("") ylabel(,labsize(medium))  xlabel(0(.1)1, labsize(medium) nogrid) msize(large) msymbol(circle) mlcolor(black) xsize(6) ysize(3) ciopts(color(black)) $mlabel 	
				graph export items_gender_post.tif, replace	

*HYPOTHESIS 4: "Female politicians are more averse than male politicians are to negative comments"

	*Primary model
	reg aversion i.messagetype##i.woman, cluster(mergenum) 
	eststo aversion_woman
	margins, dydx(woman) 							// these results determine H4
	margins, dydx(woman) at(messagetype=(1 2 3 4)) 	// these results determine H4
	margins, at(woman=(0 1) messagetype=(1 2 3 4))
	
	*FIGURE: Aversion to negative messages, conditional on gender of respondent
	estimates restore aversion_woman
	margins i.messagetype#woman, post
	eststo aversion_woman_fig
	coefplot	(aversion_woman_fig, mfcolor(gs6) keep(*#0.woman)) ///
				(aversion_woman_fig, mfcolor(white) keep(*#1.woman)), 	///
				nolabel headings(1.messagetype#0.woman= "{bf: Criticism}" 2.messagetype#0.woman = "{bf: Insults}" 3.messagetype#0.woman = "{bf: Threats}" 4.messagetype#0.woman = "{bf: Sexism}",  labsize(medlarge) )  /// 
				coeflabels(1.messagetype#0.woman 2.messagetype#0.woman 3.messagetype#0.woman 4.messagetype#0.woman = "Male respondent" ///
				1.messagetype#1.woman 2.messagetype#1.woman 3.messagetype#1.woman 4.messagetype#1.woman = "Female respondent") ///
				order(1.messagetype#0.woman 1.messagetype#1.woman  2.messagetype#0.woman 2.messagetype#1.woman  3.messagetype#0.woman 3.messagetype#1.woman  4.messagetype#0.woman 4.messagetype#1.woman ) ///
				grid(within glpattern(solid) glwidth(*0.25)) title("") ylabel(,labsize(medium))  xlabel(0(.1)1, labsize(medium) nogrid) msize(large) msymbol(circle) mlcolor(black) xsize(6) ysize(3) legend(off) ciopts(color(black)) $mlabel  
				graph export aversion_respondentgender.tif, replace


	*FIGURE FOR APPENDIX: RESULTS FOR INDIVIDUAL ITEMS
	reg abusive i.messagetype##i.woman, cluster(mergenum) 
	margins i.messagetype#woman, pwcompare post
	eststo abusive_woman_fig 
	reg legit i.messagetype##i.woman, cluster(mergenum) 
	margins i.messagetype#woman, pwcompare post
	eststo legit_woman_fig
	reg report i.messagetype##i.woman, cluster(mergenum) 
	margins i.messagetype#woman, pwcompare post
	eststo  report_woman_fig	
	
	coefplot	(abusive_woman_fig, mfcolor(gs6) keep(*#0.woman)) (abusive_woman_fig, mfcolor(white) keep(*#1.woman)), bylabel("The commment" "is abusive") subtitle(, size(large)) || 	///
				(legit_woman_fig, mfcolor(gs6) keep(*#0.woman)) (legit_woman_fig, mfcolor(white) keep(*#1.woman)), bylabel("Politicians should be able" "to tolerate comments like this") || 	///
				(report_woman_fig, mfcolor(gs6) keep(*#0.woman)) (report_woman_fig, mfcolor(white) keep(*#1.woman)), bylabel("I would report this message" "to [Twitter/Facebook]")  	///
				byopts( row(1) legend(off) ) 	///
				nolabel headings(1.messagetype#0.woman= "{bf: Criticism}" 2.messagetype#0.woman = "{bf: Insults}" 3.messagetype#0.woman = "{bf: Threats}" 4.messagetype#0.woman = "{bf: Sexism}",  labsize(medlarge) )  /// 
				coeflabels(1.messagetype#0.woman 2.messagetype#0.woman 3.messagetype#0.woman 4.messagetype#0.woman = "Male respondent" ///
				1.messagetype#1.woman 2.messagetype#1.woman 3.messagetype#1.woman 4.messagetype#1.woman = "Female respondent") ///
				order(1.messagetype#0.woman 1.messagetype#1.woman  2.messagetype#0.woman 2.messagetype#1.woman  3.messagetype#0.woman 3.messagetype#1.woman  4.messagetype#0.woman 4.messagetype#1.woman ) ///
				grid(within glpattern(solid) glwidth(*0.25)) title("") ylabel(,labsize(medium))  xlabel(0(.1)1, labsize(medium) nogrid) msize(large) msymbol(circle) mlcolor(black) xsize(6) ysize(3) legend(off) ciopts(color(black)) $mlabel 
				graph export items_respondentgender.tif, replace
	
	
***Other exploratory models****	

*Facebook versus Twitter
	reg aversion i.messagetype##i.channel_post, cluster(mergenum)
	margins, dydx(channel_post) 							// There are no significant difference in aversion to posts on Facebook vs. Twitter
	margins, dydx(channel_post) at(messagetype=(1 2 3 4)) 	// There are no significant difference in aversion to posts on Facebook vs. Twitter

*LR categorical
	reg aversion i.messagetype##i.lr_cat, cluster(mergenum)
	eststo aversion_lr_cat
	
	eststo aversion_lr_cat
	margins, at(messagetype=(1 2 3 4) lr_cat=(0 1 2)) pwcompare(groups)
	
	*FIGURE FOR APPENDIX: 
	estimates restore aversion_lr_cat
	margins, at(messagetype=(1 2 3 4) lr_cat=(0 1 2)) post
	coefplot, headings(1._at = `" "{bf: Criticism}" " " "' 4._at = `" "{bf: Insults}" " " "' 7._at = `" "{bf: Threats}" " " "' 10._at = `" "{bf: Sexism}" " " "', gap(3) labsize(medlarge)) 	///
				coeflabels(	1._at  4._at 7._at 10._at = "Left (0-3)" ///
							2._at  5._at 8._at 11._at = "Center (4-6)" ///
							3._at  6._at 9._at 12._at = "Right (7-10)" ) ///
   				order(1._at . 2._at . 3._at 4._at . 5._at . 6._at 7._at . 8._at . 9._at 10._at . 11._at . 12._at ) ///
				grid(within glpattern(solid) glwidth(*0.25)) title("") ylabel(,labsize(medium)) xlabel(0(.1)1, labsize(medium) nogrid) msize(medium) msymbol(circle) mlcolor(black) mfcolor(white)  ///
				xsize(6) ysize(3) legend(off) ciopts(color(black)) $mlabel 	mlabsize(medium) 
				graph export aversion_lr_cat.tif, replace		

************
***Tables***
************

	esttab	aversion_ownparty 		aversion_lr 		aversion_genderpost 		aversion_woman 		using primary_models.rtf, 		replace r2 b(2) se(2) compress wide label  interaction(" x ") noomitted nomtitles  ///
		order(		1.messagetype	2.messagetype 3.messagetype 4.messagetype 0.ownparty 1.ownparty 1.messagetype#1.ownparty 2.messagetype#1.ownparty 3.messagetype#1.ownparty 4.messagetype#1.ownparty /// 
					lr  1.messagetype#c.lr 2.messagetype#c.lr 3.messagetype#c.lr 4.messagetype#c.lr ///
					2.gender_post 3.gender_post 1.messagetype#3.gender_post  2.messagetype#3.gender_post 3.messagetype#3.gender_post 4.messagetype#3.gender_post ///
					0.woman 1.woman 1.messagetype#1.woman 2.messagetype#1.woman 3.messagetype#1.woman 4.messagetype#1.woman ///
					_cons ) ///
		refcat(		1.messagetype "{\i Comment type:}" 0.ownparty "{\i Partisanship:}" lr "{\i Left-Right Position:}" 2.gender_post "{\i Gender of victim:}"  0.woman "{\i Gender of respondent:}" , nolabel) ///
		coeflabel(	0.woman "Man" 1.woman "Woman" 2.gender_post "Man" 3.gender_post "Woman" 2.messagetype#3.gender_post ///
					"Insult x Woman" 3.messagetype#3.gender_post "Threat x Woman" 4.messagetype#3.gender_post "Sexist remark x Woman" resp_age "{\i Age}") ///
		drop(		1.messagetype#* ) ///
		note("Notes: OLS regression coefficients (standard errors, clustered by respondent).") 
		

	esttab	aversion_lr_cat using exploratory_models.rtf, replace r2 b(2) se(2) compress wide label  interaction(" x ") noomitted nomtitles  ///
		refcat(		1.messagetype "{\i Comment type:}" 0.lr_cat "{\i Left-Center-Right Position:}" lr_distance "{\i Left-Right Distance:}" , nolabel) ///
		coeflabels(	0.lr_cat "Left" 1.lr_cat "Center" 2.lr_cat "Right" ///
					2.messagetype#1.lr_cat "Insult x Center" 2.messagetype#2.lr_cat " Insult x Right" ///
					3.messagetype#1.lr_cat "Threat x Center" 3.messagetype#2.lr_cat " Threat x Right" ///
					4.messagetype#1.lr_cat "Sexist Remark x Center" 4.messagetype#2.lr_cat " Sexist remark x Right") ///
		drop(1.messagetype#* ) ///
		note("Notes: OLS regression coefficients (standard errors, clustered by respondent).") 		
		
		
*************
***THE END***	
*************

